import request from '@/utils/request'

const baseUrl = '/api/ziguang-form'


// 查询数据字典列表
export function getDataDicList(params) {
  return request({
    url: `${baseUrl}/api/v1/mes/basic/dataDic/list`,
    method: 'GET',
    params,
  })
}

// 新增或修改数据字典
export function setDataDic(data) {
  return request({
    url: `${baseUrl}/api/v1/mes/basic/dataDic`,
    method: 'POST',
    data,
  })
}

// 获取数据字典详情
export function getDataDicItem(params) {
  return request({
    url: `${baseUrl}/api/v1/mes/basic/dataDicTag/list`,
    method: 'GET',
    params,
  })
}

// 删除数据字典
export function delDataDicItem(params) {
  return request({
    url: `${baseUrl}/api/v1/mes/basic/dataDic`,
    method: 'DELETE',
    params,
  })
}

// 获取规则列表
export function getRuleList(params, data) {
  return request({
    url: `${baseUrl}/api/v1/mes/basic/dataRule/list`,
    method: 'POST',
    params,
    data
  })
}

// 新建/编辑规则列表
export function setRuleItem(data) {
  return request({
    url: `${baseUrl}/api/v1/mes/basic/dataRule`,
    method: 'POST',
    data
  })
}

// 删除规则列表
export function delRuleItem(params) {
  return request({
    url: `${baseUrl}/api/v1/mes/basic/dataRule`,
    method: 'DELETE',
    params
  })
}

// 获取数据源列表
export function getDataSourceList(params, data) {
  return request({
    url: `${baseUrl}/api/v1/mes/basic/dataSource/list`,
    method: 'POST',
    params,
    data
  })
}

// 新建/编辑数据源
export function setDataSourceItem(data) {
  return request({
    url: `${baseUrl}/api/v1/mes/basic/dataSource`,
    method: 'POST',
    data
  })
}

// 删除数据源
export function delDataSourceItem(params) {
  return request({
    url: `${baseUrl}/api/v1/mes/basic/dataSource`,
    method: 'DELETE',
    params
  })
}

// 获取API列表
export function getApiList(params, data) {
  return request({
    url: `${baseUrl}/api/v1/mes/basic/dataInterface/list`,
    method: 'POST',
    params,
    data
  })
}

// 新建/编辑API
export function setApiItem(data) {
  return request({
    url: `${baseUrl}/api/v1/mes/basic/dataInterface`,
    method: 'POST',
    data
  })
}

// 删除API
export function delApiItem(params) {
  return request({
    url: `${baseUrl}/api/v1/mes/basic/dataInterface`,
    method: 'DELETE',
    params
  })
}

// 查询表单
export function getFormList(params, data) {
  return request({
    url: `${baseUrl}/api/v1/mes/basic/form/list`,
    method: 'POST',
    params,
    data
  })
}

// 查询表单
export function getSimpleFormList(params, data) {
  return request({
    url: `${baseUrl}/api/v1/mes/basic/form/simple/list`,
    method: 'POST',
    params,
    data
  })
}

// 新建/编辑表单
export function setFormItem(data) {
  return request({
    url: `${baseUrl}/api/v1/mes/basic/form`,
    method: 'POST',
    data
  })
}

// 删除表单
export function delFormItem(params) {
  return request({
    url: `${baseUrl}/api/v1/mes/basic/form`,
    method: 'DELETE',
    params
  })
}

// 新建/编辑表单类型
export function setFormTypeItem(data) {
  return request({
    url: `${baseUrl}/api/v1/mes/basic/formType`,
    method: 'POST',
    data
  })
}

//查询表单类型
export function getFormTypeItem(params, data) {
  return request({
    url: `${baseUrl}/api/v1/mes/basic/formType/list`,
    method: 'POST',
    params,
    data
  })
}

// 调用接口
export function invokeInterface(id, data) {
  return request({
    url: `${baseUrl}/api/v1/mes/basic/dataInterface/data`,
    method: 'POST',
    params: {
      dataInterfaceName: id
    },
    data
  })
}

// 测试接口
export function invokeInterTest(data) {
  return request({
    url: `${baseUrl}/api/v1/mes/basic/dataInterface/test`,
    method: 'POST',
    data
  })
}
